package com.yilin.tms.core.entity.data.etc;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yilin.tms.core.commons.base.BaseDataEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "data_etc_order")
public class EtcOrder extends BaseDataEntity {

    // ETC状态
    public enum EtcStatus {
        startReady(0,"准备提交开始指令"),
        startSuccess(1,"开始指令成功"),
        startFail(2,"开始指令失败"),
        endReady(3,"准备提交结束指令"),
        endSuccess(4,"结束指提交成功"),
        endFail(5,"结束指令失败"),
        billing(6,"正在开票中"),
        billingEnd(7,"开票结束"),
        invalid(8,"失效");

        @EnumValue
        public Integer index;
        public String name;

        EtcStatus(Integer index, String name) {
            this.index = index;
            this.name = name;
        }
    }

    public enum EtcOrderType{
        realtime(0,"实时运单"),
        history(0,"历史运单");

        @EnumValue
        public Integer index;
        public String name;

        EtcOrderType(Integer index, String name) {
            this.index = index;
            this.name = name;
        }
    }
    @Column(name = "etc_status")
    private EtcStatus etcStatus;//ETC状态
    @Column(name = "etc_order_type")
    private EtcOrderType etcOrderType;//ETC运单类型
    @Column(name = "rob_order_confirm_id")
    private String robOrderConfirmId;
    @Column(name = "num")
    private String num;//运单编号
    @Column(name = "plate_number")
    private String plateNumber;//车牌号
    @Column(name = "plate_color")
    private String plateColor;//车牌颜色
    @Column(name = "start_time")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date startTime;//运单开始时间
    @Column(name = "source_addr")
    private String sourceAddr;//运单开始地址
    @Column(name = "dest_addr")
    private String destAddr;//运单目的地址
    @Column(name = "predict_end_time")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private String predictEndTime;//运单预计完成时间
    @Column(name = "fee")
    private Integer fee;//运单费用 分
    @Column(name = "title_type")
    private Integer titleType;//发票抬头类型1-2
    @Column(name = "taxplayer_code")
    private String taxplayerCode;//公司营业执照编号
    @Column(name = "real_dest_addr")
    private String realDestAddr;//运单实际目的地址
    @Column(name = "end_time")
    private String endTime;//运单实际结束时间


    @Column(name = "next_billing_time")
    private Date nextBillingTime;//下次开票时间
    @Column(name = "billing_time")
    private Date billingTime;//开票时间
    @Column(name = "billing_count")
    private Integer billingCount;//已开票次数
    @Column(name = "context" ,columnDefinition="TEXT")
    private String context;//发票内容
    //自动提交次数
    @Column(name = "auto_post_count")
    private Integer autoPostCount;
    @Column(name = "fail_reason")
    private String failReason;//失败原因

    @Transient
    @TableField(exist = false)
    private  Boolean canHistory;



    public Boolean getCanHistory() {
        return canHistory;
    }

    public void setCanHistory(Boolean canHistory) {
        this.canHistory = canHistory;
    }

    public Integer getAutoPostCount() {
        return autoPostCount;
    }

    public void setAutoPostCount(Integer autoPostCount) {
        this.autoPostCount = autoPostCount;
    }

    public String getFailReason() {
        return failReason;
    }

    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }

    public EtcOrderType getEtcOrderType() {
        return etcOrderType;
    }

    public void setEtcOrderType(EtcOrderType etcOrderType) {
        this.etcOrderType = etcOrderType;
    }

    public Date getNextBillingTime() {
        return nextBillingTime;
    }

    public void setNextBillingTime(Date nextBillingTime) {
        this.nextBillingTime = nextBillingTime;
    }

    public Date getBillingTime() {
        return billingTime;
    }

    public void setBillingTime(Date billingTime) {
        this.billingTime = billingTime;
    }

    public Integer getBillingCount() {
        return billingCount;
    }

    public void setBillingCount(Integer billingCount) {
        this.billingCount = billingCount;
    }

    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public String getRobOrderConfirmId() {
        return robOrderConfirmId;
    }

    public void setRobOrderConfirmId(String robOrderConfirmId) {
        this.robOrderConfirmId = robOrderConfirmId;
    }

    public EtcStatus getEtcStatus() {
        return etcStatus;
    }

    public void setEtcStatus(EtcStatus etcStatus) {
        this.etcStatus = etcStatus;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public String getPlateNumber() {
        return plateNumber;
    }

    public void setPlateNumber(String plateNumber) {
        this.plateNumber = plateNumber;
    }

    public String getPlateColor() {
        return plateColor;
    }

    public void setPlateColor(String plateColor) {
        this.plateColor = plateColor;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public String getSourceAddr() {
        return sourceAddr;
    }

    public void setSourceAddr(String sourceAddr) {
        this.sourceAddr = sourceAddr;
    }

    public String getDestAddr() {
        return destAddr;
    }

    public void setDestAddr(String destAddr) {
        this.destAddr = destAddr;
    }

    public String getPredictEndTime() {
        return predictEndTime;
    }

    public void setPredictEndTime(String predictEndTime) {
        this.predictEndTime = predictEndTime;
    }

    public Integer getFee() {
        return fee;
    }

    public void setFee(Integer fee) {
        this.fee = fee;
    }

    public Integer getTitleType() {
        return titleType;
    }

    public void setTitleType(Integer titleType) {
        this.titleType = titleType;
    }

    public String getTaxplayerCode() {
        return taxplayerCode;
    }

    public void setTaxplayerCode(String taxplayerCode) {
        this.taxplayerCode = taxplayerCode;
    }

    public String getRealDestAddr() {
        return realDestAddr;
    }

    public void setRealDestAddr(String realDestAddr) {
        this.realDestAddr = realDestAddr;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }
}
